#ifndef VALUE_H
#define VALUE_H
#include <QList>
class Value
{
public:
    enum Type { UNDEFINED = 0x00, SCALAR = 0x01, VECTOR = 0x02 };
    Value();
    Value(int i);
    Value(double d);
    Value(const Value& val);
    Value(const QList<double>& l);
    virtual ~Value();

    Value& operator=(double d);
    Value& operator=(const Value& v);
    Value& operator=(const QList<double>& l);

    Value operator-() const;
    Value operator+(const Value& v) const;
    Value operator*(const Value& v) const;
    Value operator^(const Value& v) const;

    Value norm() const;

    bool isUndefined() const;

    static Value& Undefined(){
        Value* v = new Value();
        return *v;
    }

    bool operator==(const Value& v) const;
    bool operator!=(const Value& v) const;
    bool operator<(const Value& v) const;
    bool operator<=(const Value& v) const;
    bool operator>(const Value& v) const;
    bool operator>=(const Value& v) const;

protected:
    void free();
    double *_ptr;
    int _type;
    int _dim;

};

#endif // VALUE_H
